package com.dragon.graduation.roleMenu.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dragon.graduation.menu.entity.MenuEntity;
import com.dragon.graduation.roleMenu.entity.RoleMenuEntity;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 角色菜单表 Mapper 接口
 * </p>
 *
 * @author dragon
 * @since 2025-02-28 21:21:44
 */
@Mapper
public interface RoleMenuMapper extends BaseMapper<RoleMenuEntity> {

    List<MenuEntity> findMenuByRole(@Param("roleId")Integer roleId);

    @Delete("delete from db_role_menu where role_id = #{roleId}")
    void deleteByRoleId(Integer roleId);

    @Select("select menu_id from db_role_menu where role_id = #{roleId}")
    List<Integer> findMenuId(Integer roleId);
}
